#!/bin/bash
# Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

#=============================================================================
# Check PFMG for power-of-two and non-power-of-two systems
#=============================================================================

# power-of-two

mpirun -np 1 ./struct -n 16 16 16 -p 16 16 0 -P 1 1 1 -solver 1 > periodic.out.10
mpirun -np 2 ./struct -n  8 16 16 -p 16 16 0 -P 2 1 1 -solver 1 > periodic.out.11
mpirun -np 4 ./struct -n  8  8 16 -p 16 16 0 -P 2 2 1 -solver 1 > periodic.out.12
mpirun -np 4 ./struct -n 16  8  8 -p 16 16 0 -P 1 2 2 -solver 1 > periodic.out.13

mpirun -np 1 ./struct -n 16 16 16 -p 16 0 16 -P 1 1 1 -skip 1 -rap 1 -solver 1 \
> periodic.out.20
mpirun -np 2 ./struct -n  8 16 16 -p 16 0 16 -P 2 1 1 -skip 1 -rap 1 -solver 1 \
> periodic.out.21

# non-power-of-two

mpirun -np 1 ./struct -n 20 20 20 -p  0 20 20 -P 1 1 1 -solver 1 > periodic.out.30
mpirun -np 2 ./struct -n 10 20 20 -p  0 20 20 -P 2 1 1 -solver 1 > periodic.out.31
mpirun -np 4 ./struct -n 10 20 10 -p  0 20 20 -P 2 1 2 -solver 1 > periodic.out.32
mpirun -np 4 ./struct -n 20 10 10 -p  0 20 20 -P 1 2 2 -solver 1 > periodic.out.33

mpirun -np 1 ./struct -n 20 20 20 -p  20 0 20 -P 1 1 1 -skip 1 -rap 1 -solver 1 \
> periodic.out.40
mpirun -np 2 ./struct -n 20 20 10 -p  20 0 20 -P 1 1 2 -skip 1 -rap 1 -solver 1 \
> periodic.out.41

#=============================================================================
# Check SMG
#=============================================================================

# power-of-two

mpirun -np 1 ./struct -n 16 16 16 -p 16 0 16 -P 1 1 1 -solver 0 > periodic.out.50
mpirun -np 2 ./struct -n  8 16 16 -p 16 0 16 -P 2 1 1 -solver 0 > periodic.out.51
mpirun -np 4 ./struct -n  8  8 16 -p 16 0 16 -P 2 2 1 -solver 0 > periodic.out.52
mpirun -np 4 ./struct -n 16  8  8 -p 16 0 16 -P 1 2 2 -solver 0 > periodic.out.53

# non-power-of-two
mpirun -np 3 ./struct -n 10 10 10 -p  0 0 30 -P 1 1 3 -solver 0 > periodic.out.60
